#pragma once
#define FIFOFILE_NAME "myfifo"
#define MODE 0666
#define SIZE 1024
#include <iostream>
#include <sys/types.h>
#include <sys/stat.h>
#include <cstdio>
#include <cstdlib>
#include <unistd.h>
#include <fcntl.h>
#include "log.hpp"
Log log;
class Init
{
    public:
    Init()
    {
    //创建管道文件
    int retmk=mkfifo(FIFOFILE_NAME,MODE);
    if(retmk<0)
    {
        log(Fatal,"mkfifo err!! erromessage:%s  error code: %d",strerror(errno),errno);
        exit(1);
    }
    }
    ~Init()
    {
        //删除管道文件
    int retlink=unlink(FIFOFILE_NAME);
    if(retlink==-1)
    {
        log(Fatal,"unlink file !! erromessage:%s  error code: %d",strerror(errno),errno);

        //perror("ulink");
        exit(2);
    }
    }
};